import 'package:flutter/material.dart';

import '../../utils/logger.dart';

class ChipsPage extends StatefulWidget {
  const ChipsPage({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() => _ChipsPageState();
}

class _ChipsPageState extends State<ChipsPage> {
  int? _value;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('chips'),
        ),
        body: ListView(
          children: <Widget>[
            Center(
                child: Wrap(
              children: List<Widget>.generate(
                3,
                (int index) {
                  return ChoiceChip(
                    label: Text('Item $index'),
                    selected: _value == index,
                    onSelected: (bool selected) {
                      setState(() {
                        _value = selected ? index : null;
                      });
                    },
                  );
                },
              ).toList(),
            )),
            Center(
              child: InputChip(
                  avatar: CircleAvatar(
                    backgroundColor: Colors.grey.shade800,
                    child: const Text('AB'),
                  ),
                  label: const Text('Aaron Burr'),
                  onPressed: () {
                    logger.info('I am the one thing in life.');
                  }),
            )
          ],
        ));
  }
}
